package com.ruibang.glass.produce.controller.pl;

import com.ruibang.glass.produce.domain.req.ClassReportReq;
import com.ruibang.glass.produce.entity.ClassReport;
import com.ruibang.glass.produce.service.ClassReportService;
import com.teaming.cloud.framework2.common.model.ResultBody;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * <p>
 * 生产-配料-班报填写 前端控制器
 * </p>
 *
 * @author songJinKang
 * @since 2024-04-17
 */
@RestController
@RequestMapping("/api/produce/class/report")
@Api(value = "生产-配料-班报填写控制器", tags = {"生产-配料-班报填写接口"})
public class ClassReportController {

    @Autowired
    private ClassReportService classReportService;

    @GetMapping("/getById/{id}")
    @ApiOperation(value = "获取生产-配料-班报填写", notes = "获取生产-配料-班报填写")
    public ResultBody getById(@PathVariable(value = "id") String id) {
        return ResultBody.success(classReportService.getById(id));
    }

    @PostMapping("/save")
    @ApiOperation(value = "新增生产-配料-班报填写", notes = "新增生产-配料-班报填写")
    public ResultBody save(@RequestBody ClassReport classReport) {
        classReportService.save(classReport);
        return ResultBody.success();
    }

    @DeleteMapping("/deleteById/{id}")
    @ApiOperation(value = "通过ID删除生产-配料-班报填写", notes = "通过ID删除生产-配料-班报填写")
    public ResultBody delete(@PathVariable(value = "id") String id) {
        classReportService.deleteById(id);
        return ResultBody.success();
    }

    @PostMapping("/update")
    @ApiOperation(value = "修改生产-配料-班报填写", notes = "修改生产-配料-班报填写")
    public ResultBody updateById(@RequestBody ClassReport classReport) {
        classReportService.updateById(classReport);
        return ResultBody.success();
    }

    @PostMapping("/pageQuery")
    @ApiOperation(value = "分页列表查询生产-配料-班报填写", notes = "分页列表查询生产-配料-班报填写")
    public ResultBody pageQuery(@RequestBody ClassReportReq classReportReq) {
        return ResultBody.success(classReportService.pageQuery(classReportReq));
    }
}
